package com.hxkj.domain.context;

import java.util.HashMap;
import java.util.Map;

/**
 * freemarker环境上下文管理器
 * <p>
 * Create by chenwei on 2018/9/14 15:41
 */
public class EnvironmentContextHolder {

    private static final ThreadLocal<Map<String, Object>> localEnvironment = new ThreadLocal(){
        protected Map<String, Object> initialValue() {
            return new HashMap<String, Object>();
        }
    };

    public static void setEnviromentPage(Map<String, Object> enviroment) {
        localEnvironment.set(enviroment);
    }

    public static Map<String, Object> getEnvironment() {
        return localEnvironment.get();
    }

    public static void removeEnvironment() {
        localEnvironment.remove();
    }
}
